package com.kmust.dream.wanderingdream.donation.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kmust.dream.wanderingdream.donation.entity.DonationMoneyEntity;
import com.kmust.dream.wanderingdream.donation.service.DonationMoneyService;
import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.R;



/**
 *
 *
 * @author Leng
 * @email Leng81605@gmail.com
 * @date 2021-07-11 14:11:07
 */
@RestController
@Api(tags = "捐钱")
@RequestMapping("donation/donationmoney")
@Deprecated
public class DonationMoneyController {
    @Autowired
    private DonationMoneyService donationMoneyService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = donationMoneyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{donationId}")

    public R info(@PathVariable("donationId") Integer donationId){
		DonationMoneyEntity donationMoney = donationMoneyService.getById(donationId);

        return R.ok().put("donationMoney", donationMoney);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody DonationMoneyEntity donationMoney){
		donationMoneyService.save(donationMoney);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")

    public R update(@RequestBody DonationMoneyEntity donationMoney){
		donationMoneyService.updateById(donationMoney);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] donationIds){
		donationMoneyService.removeByIds(Arrays.asList(donationIds));

        return R.ok();
    }

}
